package com.livew.framework.utils;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;

public abstract class XTPropertiesUtil {


	private static Properties prop = new Properties();
	
	/**
	 * 初始化properties，即载入数据
	 */
	static void initProperties(String file) {
		try {
			InputStreamReader ips = new InputStreamReader(
					XTPropertiesUtil.class.getClassLoader().getResourceAsStream(file), "utf-8");
			prop.load(ips);
			ips.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	protected static String getProperty(String key,String file) {
		initProperties(file);
		String res = prop.getProperty(key);
		return res;
	}

}
